//
//  LGTRWZPostSelectCell.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/22.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit

class LGTRWZPostSelectCell: UITableViewCell {

    var titleLabel:UILabel?
    var descLabel:UILabel?
    private var _model:Dictionary<String, Any>?
    var model:Dictionary<String, Any>{
        get{
            return _model ?? Dictionary.init()
        }set{
            _model = newValue
            self.setData()
        }
    }
    
    func setData(){
        self.titleLabel?.text = self.model["title"] as? String ?? ""
        self.descLabel?.text = self.model["subText"] as? String ?? ""
        self.descLabel?.textColor = TextColor
        if self.descLabel?.text?.count == 0{
            self.descLabel?.text = "请选择"
            self.descLabel?.textColor = GrayColor
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        self.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
        self.titleLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15))
        self.addSubview(self.titleLabel!)
        self.titleLabel?.snp.makeConstraints({ (make) in
            //make.top.equalTo(SizeFit(19))
            make.left.equalTo(SizeFit(14))
            make.centerY.equalTo(self)
            make.height.equalTo(SizeFitFloat(15))
        })
        
        self.descLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.right, textColor: ColorUtil(color: 0x999999), fontSize: SizeFitFloat(15), text: "请选择")
        self.addSubview(self.descLabel!)
        self.descLabel?.snp.makeConstraints({ (make) in
            make.centerY.equalTo(self)
            make.right.equalTo(-SizeFit(35))
            make.height.equalTo(SizeFitFloat(15))
        })
        
        let line:UIImageView = LGTViewCreateUtil.share.createLineView()
        self.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.top.equalTo(42)
            make.height.equalTo(1)
            make.left.equalTo(SizeFitFloat(13))
            make.right.equalTo(SizeFitFloat(-11))
            make.bottom.equalTo(0)
        }
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
//    func setData(){
////        self.titleLabel?.text = self.model["title"] as? String ?? ""
////        let limit:Int = self.model["limit"] as? Int ?? -1
////        self.textField?.updateInfo(fontSize: SizeFitFloat(15), textColor: TextColor, limitCount: limit, placeHoder: self.model["placehoder"] as? String ?? "")
////        self.textField?.textView.keyboardType = self.model["keyboard"]  as? UIKeyboardType ?? UIKeyboardType.default
//    }
}
